<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>第 07 题</title>
    <script type="text/javascript">
        /*
            07、将"i love javascript very much"的每个单词的第一个字母，变为大写。
        */

        // 创建字符串
        var oStr = "i love javascript very much";

        function oBig(i) {
            // 转数组
            oArr = i.split(" ");

            // 将数组中每一个词的首字母改为大写
            for (var oA = 0; oA < oArr.length; oA++) {
                oArr[oA] = oArr[oA].charAt(0).toUpperCase() + oArr[oA].slice(1);
            }

            // 转回字符串形式
            oStr = oArr.join(" ");

            // 返回值
            return oStr;
        }

        // 后台输出
        console.log(oBig(oStr));
    </script>
</head>

<body>

</body>

</html>